package com.woniu.humanresource.controller;

import com.woniu.humanresource.entity.Contract;
import com.woniu.humanresource.entity.RecruitmentChannel;
import com.woniu.humanresource.entity.ResponseText;
import com.woniu.humanresource.exception.GeneralException;
import com.woniu.humanresource.service.RecruitChannelService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class RecruitChannelController {
    @Resource
    RecruitChannelService recruitChannelService;
    //查询渠道信息
    @PostMapping("/recruitChannel")
    public ResponseText<List<RecruitmentChannel>> getRecruitChannel(){
        ResponseText<List<RecruitmentChannel>> responseText=null;
        try {
            List<RecruitmentChannel> recruitmentChannels = recruitChannelService.selectAll();
            responseText=new ResponseText<List<RecruitmentChannel>>(recruitmentChannels,200,"success");
        } catch (Exception e) {
            e.printStackTrace();
            throw new GeneralException();
        }
        return responseText;
    }
}
